package cn.dw.mm.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.dw.mm.domain.Basic;
import cn.dw.mm.service.BasicService;

/**
 *  @author Guang
 *  @date 2018/07/25 16:49
 *   */
@Controller
@RequestMapping(value="/basic")
public class BasicController {
	
	@Autowired
	private BasicService basicService;
	
	//查
	@RequestMapping(value="/query")
	@ResponseBody
	//不设置@ResponseBody，返回的String对象将被controller解析成页面的名称
	public Basic query(Basic basic) {
		Basic b = basicService.query(basic.getId());
		return (b);
	}
	
	@RequestMapping(value="/selectAll")
	@ResponseBody
	public List<Basic> selectAll(Basic basic) {
		return basicService.selectAll(basic);
	}
	//增
	@RequestMapping(value="/add")
	@ResponseBody
	public String add(Basic basic) {
		basicService.add(basic);
		return "You add data successfully!";
	}
	//删
	
	//改
	
	@RequestMapping("/page")
	public String page() {
		return "basic/list";
	}
}
